home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
MPEG 3 Utilities
/
MacAMP 1.0b7
/
Visual Plugins Programming
/
visual.h
< prev
Wrap
C/C++ Source or Header
|
1999-01-30
|
6KB
|
141 lines
#pragma once
/*
Visual Plug-in API
©1998, @soft
Description: The plugin API for MacAmp visual plugins.
Version: 1.2
Released: 1/30/99
Compatibility: MacAmp 1.0b7+
Version history:
Date Who Changes
------+------+------------------------------------------------------
013099 SK Added extended stuff for 1.1 plugins.
090598 SK Commented the file, cleaned the unnesessary stuff.
090198 SK Initial release
*/
#define VP_API_VERSION 0x01
#define VP_EXT_API_VERSION 0x02
// Plugin types
enum {
plugVisual = 'vis!' // Visual plugin
};
// Plugin return values
enum {
visNoErr = noErr,
visTerminate = 1, // terminate the plugin
visNoMemory = 2, // terminate the plugin and display no memory alert
// all other returns will cause plugin termination and "unknown plugin error" alert.
callbackNoSong = 1310, // Returned by callback (see below), if you're trying to get information
// about the song while none is playing.
callbackNoID3 = 1311 // Returned by callback (see below) callback->getID3, if no ID3 tag information
// for the song is present. Note that id3short is still valid and contains
// file name.
};
// plugin flags
enum {
flagHasSettings = 0x01, // Plugin can display and handle settings dialog
flagGetKeyDown = 0x02, // Plugin wants to get keydown events
flagGetIdle = 0x04 // Plugin wants to get idle events
};
// Function prototypes (see dummy plug for the explanations)
extern OSErr PlugInitialize(WindowPtr* window, FSSpecPtr plug, UInt32* refcon);
extern OSErr PlugTerminate(WindowPtr window, UInt32* refcon);
extern OSErr PlugProcess(WindowPtr window, short chan, const double* stream, short dataSize, UInt32* refcon);
extern OSErr PlugMacEvent(WindowPtr window, EventRecord* event, UInt32* refcon);
extern OSErr PlugKeyDown(WindowPtr window, char key, short modifiers, UInt32* refcon);
extern OSErr PlugIdle(WindowPtr window, UInt32* refcon);
extern OSErr PlugSettings(WindowPtr window, UInt32* refcon);
extern OSErr PlugAbout(WindowPtr window, UInt32* refcon);
// • NEW FOR 1.2 •
// Gets called immediately before the song start. You can obtain ID3 information about the track here etc
// if you want -- it won't be changed until next song starts.
extern OSErr PlugSongStart(WindowPtr window, UInt32* refcon);
// Gets called immediately after the song end. It is a good idea to clear/stop any animations at this point
// because you will not receive PlugProcess calls until next song is started -- that can happen in one
// minute/one second or never. You never know. =)
extern OSErr PlugSongEnd(WindowPtr window, UInt32* refcon);
// Type defeinitions for plugin callbacks.
typedef OSErr (*vpPlugInitializeProcPtr)(WindowPtr* window, FSSpecPtr plug, UInt32* refcon);
typedef OSErr (*vpPlugTerminateProcPtr)(WindowPtr window, UInt32* refcon);
typedef OSErr (*vpPlugProcessProcPtr)(WindowPtr window, short chan, const double* stream, short dataSize, UInt32* refcon);
typedef OSErr (*vpPlugMacEventProcPtr)(WindowPtr window, EventRecord* event, UInt32* refcon);
typedef OSErr (*vpPlugKeyDownProcPtr)(WindowPtr window, char key, short modifiers, UInt32* refcon);
typedef OSErr (*vpPlugIdleProcPtr)(WindowPtr window, UInt32* refcon);
typedef OSErr (*vpPlugSettingsProcPtr)(WindowPtr window, UInt32* refcon);
typedef OSErr (*vpPlugAboutProcPtr)(WindowPtr window, UInt32* refcon);
typedef OSErr (*vpPlugSongStartProcPtr)(WindowPtr window, UInt32* refcon);
typedef OSErr (*vpPlugSongEndProcPtr)(WindowPtr window, UInt32* refcon);
// • NEW FOR 1.2 •
// These are typedefs for MacAMP hook routines. If you're specified VP_EXT_API_VERSION in gPlugInfo.api,
// these will be filled for you by MacAMP so you can call them to obtain information about the current
// song.
// This callback fills the FSSpec* to the currently playing song or returns callbackNoSong if no song
// is currently playing.
typedef OSErr (*maGetCurrentFSSpecProcPtr)(FSSpec* spec);
// Fills current track time (either real or reverse, depending on the bool setting reverse)
// Time is in seconds. You can get it by sec = (*time)%60; min = (*time)/60;
// Returns callbackNoSong if no song is playing.
typedef OSErr (*maGetCurrentTimeProcPtr)(Boolean reverse, UInt32* time);
// Fills current track position. Short will contain the position in percents, in range of 0-100.
// Returns callbackNoSong if no song is playing.
typedef OSErr (*maGetCurrentPosProcPtr)(UInt16* position);
// Fills current track ID3 information. If no ID3 tags found, only id3short is filled and
// callbackNoID3 error is returned.
// id3short is a string containing ID3 tags formatted in form
// Artist - Title
// id3long is a char* containing fully formatted ID3 tags in form
// Artist - Title - Album - Year
// Make sure id3long is at least 1024 bytes long to avoid buffer overflow, as MA does not checks
// for the length.
// Returns callbackNoSong if no song is playing.
typedef OSErr (*maGetID3InformationProcPtr)(StringPtr id3short, char* id3long);
// Returns the Ptr to qd globals.
typedef QDGlobalsPtr (*maGetQDPtrProcPtr)(void);
typedef struct {
maGetCurrentFSSpecProcPtr getFSSpecProc;
maGetCurrentTimeProcPtr getCurrentTimeProc;
maGetCurrentPosProcPtr getCurrentPosProc;
maGetID3InformationProcPtr getID3Proc;
maGetQDPtrProcPtr getQDPtrProc;
} MAVisCallbacks, *MAVisCallbacksPtr;
typedef struct {
UInt16 api; // API used. Should contain VP_EXT_API_VERSION.
OSType type; // Plugin type. Should always be plugVisual.
UInt32 flags; // Plugin flags (flagXXX constants)
UInt32 globRefcon; // Any global refcon you wish to use.
Str63 name; // Plugin name (displayed in Plugin menu)
// Pointers to plugin functions, or nil if they are not implemented.
vpPlugInitializeProcPtr initProc;
vpPlugTerminateProcPtr terminateProc;
vpPlugProcessProcPtr processProc;
vpPlugMacEventProcPtr macEventProc;
vpPlugKeyDownProcPtr keyDownProc;
vpPlugIdleProcPtr idleProc;
vpPlugSettingsProcPtr settingsProc;
vpPlugAboutProcPtr aboutProc;
// • NEW FOR 1.2 •
vpPlugSongStartProcPtr songStartProc;
vpPlugSongEndProcPtr songEndProc;
MAVisCallbacksPtr callbacks;
} VPInfoBlock, *VPInfoPtr;